#include "SingletonThreadPool.hpp"
#include "Task.hpp"
#include <unistd.h>

std::string oper = "+-*/%";
 
int main()
{
    srand(time(nullptr));

    // SingletonThreadPool<Task>* STP = new SingletonThreadPool<Task>(5);
    // STP->ThreadStart();

    SingletonThreadPool<Task>::GetInStance()->ThreadStart();

    int len = oper.size(); 
    while(true)
    {
        sleep(1);
        int data1 = rand() % 10;
        int data2 = rand() % 10 + 1;

        char op = oper[rand() % len];

        Task t(data1, data2, op);
        SingletonThreadPool<Task>::GetInStance()->push(t);

        t.GetTask();
        // sleep(1);
        // std::cout << "启动" << std::endl;
    }

    return 0;
}